package com.coolingme.algo_01_list.reverselist;

/**
 * 链表节点
 *
 * @author wangyue
 * @date 2020/10/30 13:56
 */
public class LinkedListNode {

    /**
     * 值
     */
    public Integer value;

    /**
     * 指向下一个节点的指针
     */
    public LinkedListNode next;

    public LinkedListNode(Integer value) {
        this.value = value;
    }

    public LinkedListNode setNext(Integer nextValue) {
        LinkedListNode next = new LinkedListNode(nextValue);
        this.next = next;
        return next;
    }

    @Override
    public String toString() {
        String result = this.value.toString();
        if (this.next != null) {
            result += " => " + this.next.toString();
        }
        return result;
    }

}
